pub mod types040;
pub mod convert;

use std::error::Error;
use std::io::Write;
use serde::{Deserialize,Serialize};

pub trait ResultInterface {
    fn version(&self) -> String;
    fn get_as_version(&mut self,version:String) -> Result<Box<dyn ResultInterface>,Box<dyn Error>>;
    fn print(&self) -> Result<(),Box<dyn Error>>;
    fn print_to(&self,w:Box<dyn Write>) -> Result<(),Box<dyn Error>>;
}



#[derive(Clone,Debug,Default,Serialize,Deserialize)]
pub struct Interface {
    pub name:String,
    #[serde(skip_serializing_if = "String::is_empty",default)]
    pub mac:String,
    #[serde(skip_serializing_if = "String::is_empty",default)]
    pub sandbox:String,
}

#[derive(Clone,Debug,Default,Serialize,Deserialize)]
pub struct IPConfig {
    pub interface:Option<i32>,
    pub address: String,
    pub gateway:String
}

#[derive(Clone,Debug,Default,Serialize,Deserialize)]
pub struct IPNet {
    pub ip: Vec<u8>,
    pub mask: Vec<u8>
}

#[derive(Clone,Debug,Default,Serialize,Deserialize)]
pub struct Route{
    #[serde(default,skip_serializing_if = "String::is_empty")]
    pub dst:String,
    #[serde(default,skip_serializing_if = "String::is_empty")]
    pub gw:String
}


#[derive(Clone,Debug,Default,Serialize,Deserialize)]
pub struct DNS {
    #[serde(rename="nameservers",skip_serializing_if = "Vec::is_empty",default)]
    pub name_servers:Vec<String>,
    #[serde(skip_serializing_if = "Option::is_none",default)]
    pub domain:Option<String>,
    #[serde(skip_serializing_if = "Vec::is_empty",default)]
    pub search:Vec<String>,
    #[serde(skip_serializing_if = "Vec::is_empty",default)]
    pub options:Vec<String>,
}
